package org.ourgrid.worker.collectors.gmond;

import junit.framework.TestCase;
import br.edu.ufcg.lsd.commune.identification.DeploymentID;

public class GMondCollectorComponentTest extends TestCase {
	
	private GMondCollectorComponent component;
	
	protected void setUp() throws Exception {
		super.setUp();
		component = GMondCollectorComponent.getInstance();
		//component.configure(new EntityID());
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}
	
	public void testMetricsChanged() throws Exception {
		
		FakeGMondCollectorClient client = new FakeGMondCollectorClient();
		
		//component.getModule().bind(FakeGMondCollectorClient.NAME, client, 1);
		DeploymentID serverIdentification = new DeploymentID("user12534@palmito/gmondcollector", FakeGMondCollectorClient.NAME, 1);
		//WorkerSpecListener clientStub = component.getModule().lookup(serverIdentification, WorkerSpecListener.class);
		
		assertFalse( client.wasCalled() );
		
		//component.getServer().addInterested( clientStub );
		
		Thread.sleep(30*1000);
		
		assertTrue( client.wasCalled() );
		
		//component.shutdown();
	}

}
